package br.com.ridea.pegadacultural.utilidades;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class TreatFile {
	public static final String getContent(InputStream in) {
		BufferedReader reader = null;
		try {
			reader = new BufferedReader(new InputStreamReader(in, "ISO-8859-1"));
			String contentLine = null;
			StringBuilder content = new StringBuilder();
			while ((contentLine = reader.readLine()) != null) {
				content.append(contentLine);
			}
			return content.toString();
		} catch (FileNotFoundException e) {
			throw new RuntimeException(e);
		} catch (IOException e) {
			throw new RuntimeException(e);
		} finally {
			if (in != null) {
				try {
					in.close();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
		}
	}
}
